package com.seventeen.monster.redisson.core;

import java.io.Serializable;
import java.util.Map;
import java.util.Objects;

/**
 * @author seventeen
 */
public class Message<T> implements Serializable {

    private static final long serialVersionUID = -3621892227031826909L;

    private T payload;

    private Map<String, String> headers;

    public T getPayload() {
        return payload;
    }

    public void setPayload(T payload) {
        this.payload = payload;
    }

    public Map<String, String> getHeaders() {
        return headers;
    }

    public void setHeaders(Map<String, String> headers) {
        this.headers = headers;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof Message)) {
            return false;
        }
        Message<?> that = (Message<?>) o;
        return Objects.equals(payload, that.payload);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(payload);
    }

    @Override
    public String toString() {
        return "Message{" +
                "payload=" + payload +
                ", headers=" + headers +
                '}';
    }
}
